package com.example.data_pass_back;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class ChildActivity extends AppCompatActivity {
    EditText myedit;
    final int result = 1;
    final int request = 1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.childpage);
        myedit = (EditText)findViewById(R.id.edit_id);

        Log.v("life","ChildActivity onCreate");
    }

    public void clickSubmit(View view){
        Log.v("life","ChildActivity  按钮被点击");
        String userID =  myedit.getText().toString();
        Intent intent = new Intent(this,MainActivity.class);
        intent.putExtra("userID",userID);
        intent.putExtra("userPwd","安安安男");
        setResult(result,intent);
        finish();
//        startActivityForResult(intent,1);
    }


    @Override
    protected void onStart() {
        super.onStart();
        Log.v("life","ChildActivity onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.v("life","ChildActivity onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.v("life","ChildActivity onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.v("life","ChildActivity onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.v("life","ChildActivity onDestroy");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.v("life","ChildActivity onRestart");
    }
}
